<?php
/*
Template Name: full gallery
*/
?>

<?php global $options; foreach ($options as $value) {if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }}?>
<?php get_header(); ?>


<div class="main_big_cat_top_3">
</div>

<div class="main_cats_blog" id="archivelist">

<div class="image_slug" style="background:url(<?php if ($exeimg = get_post_meta($post->ID, 'gimg', true)) { echo $exeimg; } else { ?><?php bloginfo ('template_directory'); ?>/images/imageslug.png<?php } ?>) no-repeat; ">
</div>

 <?php while (have_posts()) : the_post(); $execats = get_post_meta($post->ID, 'cat', true); endwhile; ?>

<div class="gallery_bg">
			
			<?php  query_posts('category_name=' . $execats . ''); ?>

			 <?php while (have_posts()) : the_post(); if (current_user_can('level_2')) {} else {if (in_category('private')) continue;}
			 
			  
			  
			if ($images = get_children(array(
				'post_parent' => $post->ID,
				'numberposts' => '1',
				'post_type' => 'attachment',
				'post_mime_type' => 'image',
				'order' => 'ASC',
				'orderby' => 'menu_order')))  
			 foreach($images as $image) {  
				$exehill_image = $image->guid; 
				$exehill_thumb = wp_get_attachment_thumb_url( $image->ID);			
				} else {
				$exehill_image = site_url('/wp-content/themes/exehill2/images/noimage.png');
				$exehill_thumb = site_url('/wp-content/themes/exehill2/images/noimage.png');
				}				
			    ?>


			<div class="vid_frame" >
		

				
				<div class="vid_thumb">
				
					<div class="vid_inner_thumb" style="background: url(<?php echo $exehill_thumb; ?>) no-repeat center center; ">
					
						<div id="vid_post" class="MooTrans">
					
							<div class="vid_permalink"><a onmouseover="Tip('<strong><?php the_title(); ?></strong></br>Posted by <?php the_author(); ?> on <?php the_time('M j, Y') ?> with <?php comments_number('0 responses', '1 response', '% responses' );?>')" onmouseout="UnTip()"   href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"></a>
							</div>	
						
							<div class="vid_gallery"> <a onmouseover="Tip('Open Image')" onmouseout="UnTip()" rel="lightbox[boxset]"  href="<?php echo $exehill_image; ?>" ></a>
							</div>
						
						</div>
						
					</div>
					
				</div>
				
			</div>
				<?php endwhile; ?>
	
	<div class="clear">
	</div>
	

	

	
</div>
</div>	
	
<div class="main_left_bottom_4"><span class="pagleft"><?php previous_posts_link('Previous') ?></span><span class="pagright"><?php next_posts_link('Next') ?></span>
</div>

<div class="clear">
</div>
	
<?php get_footer(); ?>
